Abstract
- Project navigation
- Navigating using Telescope
- LSP navigation
- Plugins for navigation
Project navigation
- Using alias
alias cdw='cd ~/Workspace'
- Using fuzzy finder
#!/bin/env bash
quick_exit ()
{
read VAR
if [ ! -z "${VAR}" ]; then
echo $VAR
PID=$$
kill $PID 2&> /dev/null
fi
}
fd -I -i -H \
-t d ^.git$ ~/.config ~/.s1n7ax ~/Workspace \
-x 'echo' '{//}' | sk | quick_exit
alias o='cd $(find-projects)'
Navigating using Telescope
spaceff- Fuzzy find filesspacefw- Fuzzy find word:Telescope <command>for more commands
LSP navigation
-
gd- Go to definition -
gI- Go to implementation -
gr- Go to reference -
gy- Go to definition of type -
spacelGOR:Telescope lsp_workspace_symbols- Search global symbols -
spacels- Search file symbols -
spacelS- Toggle file symbol outline -
[d- Go to prev diagnostic -
]d- Go to next diagnostic -
[f- Go to prev function -
]f- Go to next function
Frequent file navigation using harpoon
Installation
local nav = function(index)
return function()
require('harpoon.ui').nav_file(index)
end
end
local add_file = function()
require('harpoon.mark').add_file()
end
local toggle_ui = function()
require('harpoon.ui').toggle_quick_menu()
end
return {
'ThePrimeagen/harpoon',
event = 'VeryLazy',
dependencies = { 'nvim-lua/plenary.nvim' },
keys = {
{ ',l', mode = 'n', add_file, desc = 'Harpoon Add File' },
{ ',L', mode = 'n', toggle_ui, desc = 'Harpoon Toggle UI' },
{ '<c-1>', mode = 'n', nav(1), desc = 'Harpoon Jump to 1st' },
{ '<c-2>', mode = 'n', nav(2), desc = 'Harpoon Jump to 2nd' },
{ '<c-3>', mode = 'n', nav(3), desc = 'Harpoon Jump to 3rd' },
{ '<c-4>', mode = 'n', nav(4), desc = 'Harpoon Jump to 4rd' },
},
config = true,
}
Jumps in buffer using flash
Installation
return {
'folke/flash.nvim',
event = 'VeryLazy',
opts = {},
-- stylua: ignore
keys = {
{ "s", mode = { "n", "x", "o" }, function() require("flash").jump() end, desc = "Flash" },
{ "S", mode = { "n", "o", "x" }, function() require("flash").treesitter() end, desc = "Flash Treesitter" },
{ "r", mode = "o", function() require("flash").remote() end, desc = "Remote Flash" },
{ "R", mode = { "o", "x" }, function() require("flash").treesitter_search() end, desc = "Treesitter Search" },
{ "<c-s>", mode = { "c" }, function() require("flash").toggle() end, desc = "Toggle Flash Search" },
},
}